<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <title>Document</title>
    <script src="vue.js"></script>
</head>

<body>
    <div id="root">
        <input type="text" placeholder="请输入字符" @keydown.caps-lock="change">
        <h3>{{y}}</h3>
    </div>

    <script>
        Vue.config.productionTip = false;

        const vm = new Vue({
            el: '#root',
            data: {
                x: false
            },
            methods: {
                change() {
                    this.x = !this.x
                }
            },
            computed: {
                y() {
                    return this.x ? '当前已切换为大写模式!' : ''
                }
            }

        })
    </script>
</body>

</html>